import request from '../../utils/request';

// consultation-order 管理相关 API

// 创建咨询问题订单
export const createConsultationOrder = (data) => {
    return request({
        url: '/order/consultation-order',
        method: 'post',
        data: data,
    });
};

// 申请退款
export const requestRefund_2 = (orderId, params) => {
    return request({
        url: `/order/consultation-order/${orderId}/refund/request`,
        method: 'post',
        params: params,
    });
};

// 处理退款申请（驳回）
export const rejectRefund = (orderId, params) => {
    return request({
        url: `/order/consultation-order/${orderId}/refund/reject`,
        method: 'post',
        params: params,
    });
};

// 处理退款申请（通过）
export const approveRefund = (orderId, params) => {
    return request({
        url: `/order/consultation-order/${orderId}/refund/approve`,
        method: 'post',
        params: params,
    });
};

// 完成咨询问题订单
export const completeConsultationOrder = (orderId) => {
    return request({
        url: `/order/consultation-order/${orderId}/complete`,
        method: 'post',
    });
};

// 取消咨询问题订单
export const cancelConsultationOrder = (orderId, params) => {
    return request({
        url: `/order/consultation-order/${orderId}/cancel`,
        method: 'post',
        params: params,
    });
};

// 用户追问
export const followupConsultationOrder = (data) => {
    return request({
        url: '/order/consultation-order/followup',
        method: 'post',
        data: data,
    });
};

// 专家回答追问
export const answerFollowupConsultationOrder = (data) => {
    return request({
        url: '/order/consultation-order/followup-answer',
        method: 'post',
        data: data,
    });
};

// 专家回答咨询问题
export const answerConsultationOrder = (data) => {
    return request({
        url: '/order/consultation-order/answer',
        method: 'post',
        data: data,
    });
};

// 获取咨询问题订单详情
export const getConsultationOrderById = (id) => {
    return request({
        url: `/order/consultation-order/${id}`,
        method: 'get',
    });
};

// 删除咨询问题订单
export const deleteConsultationOrder = (id) => {
    return request({
        url: `/order/consultation-order/${id}`,
        method: 'delete',
    });
};

// 分页查询咨询问题订单列表
export const getConsultationOrderPage = (params) => {
    return request({
        url: '/order/consultation-order/page',
        method: 'get',
        params: params,
    });
};

// 根据订单号获取咨询问题订单详情
export const getConsultationOrderByOrderNo = (orderNo) => {
    return request({
        url: `/order/consultation-order/order-no/${orderNo}`,
        method: 'get',
    });
};

